View Javadoc
1   package edu.jiangxin.apktoolbox.file.password.recovery.checker.thirdparty;
2   
3   import edu.jiangxin.apktoolbox.utils.Constants;
4   
5   public final class ThirdParty7ZipChecker extends AbstractThirdPartyChecker {
6       @Override
7       public String[] getFileExtensions() {
8           return new String[]{"7z", "zip", "rar", "gz", "tar", "xz", "z", "001"};
9       }
10  
11      @Override
12      public String getFileDescription() {
13          return "*.7z; *.zip; *.rar; ...";
14      }
15  
16      @Override
17      public String getDescription() {
18          return "ThirdParty7ZipChecker(Using 7z.exe)";
19      }
20  
21      @Override
22      public String getToolPath() {
23          return conf.getString(Constants.SEVEN_ZIP_PATH_KEY);
24      }
25  
26      @Override
27      public boolean isFiltered(String password) {
28          if (password != null && password.contains("\"")) {
29              // It is useless to escape the password
30              logger.warn("checkPassword password contain double quote characters[Not Supported]");
31              return true;
32          }
33          return false;
34      }
35  
36      @Override
37      public String getCmd(String password) {
38          String target = file.getAbsolutePath();
39          return String.format("%s t \"%s\" -p\"%s\"", toolPath, target, password);
40      }
41  }